/*
 * Copyright (C) 2007  Vianney le Clément
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package fsahoraires.gui.pages;

import fsahoraires.programmes.Programme;
import fsahoraires.programmes.Semestre;

public class RootPage extends SimpleHtmlTemplatePage {

	private final Programme programme;

	public RootPage(Programme programme) {
		super("Aperçu du programme", "programme.png", "programme.xhtml");
		this.programme = programme;
	}

	protected String loadContent() {
		StringBuilder str = new StringBuilder("<h1>Programme complet</h1>");
		str.append("<div class='total'>Total: <span class='value'>").append(
				programme.getCredits()).append("</span> crédits</div>");
		for (Semestre sem : programme)
			SemestrePage.addSemestre(str, sem, programme);
		return str.toString();
	}

}
